package testview.zhen.com.myapplication.jetpack

import android.content.Context
import android.util.Log
import androidx.work.Data
import androidx.work.Worker
import androidx.work.WorkerParameters
import kotlinx.coroutines.delay
import java.io.DataOutput
import java.io.OutputStream
import kotlin.math.log

/**
 * Create by ldr
 * on 2019/10/14 11:04.
 */
class DelayWorker(context: Context, workerParameters: WorkerParameters) :Worker(context,workerParameters){

    override fun doWork(): Result {
        Log.i("MainWorker","点击${inputData.getString("delayWork")} --所在线程 ${Thread.currentThread().name}")
        val time = inputData.getInt("time",0)
        Thread.sleep(time*1000L)
        val data = Data.Builder().putString("LiveDataTest","LiveDataTest修改后的信息---").build()
        return  Result.success(data)

    }


}